package com.niiwoo.civet.trade.enums;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: wuke
 * @Description:
 * @Date: Created in 11:42 2017/12/1
 */
public class BorrowPrizeOccupyEnum {
    /**
     * 占用状态枚举
     */
    @AllArgsConstructor
    @Getter
    public enum OccupyStatusEnum {
        INIT((byte)1,"初始状态"),
        SUCCESS((byte)2,"占用成功"),
        FAIL((byte)3,"占用失败"),
        ERROR((byte)4,"调用异常");;

        private Byte status;
        private String desc;

        public static OccupyStatusEnum getByLevel(byte status) {
            for (OccupyStatusEnum statusEnum : values()) {
                if (statusEnum.status.equals(status)) {
                    return statusEnum;
                }
            }
            throw new NoSuchEnumValueException("OccupyStatusEnum:" + status);
        }
    }
}
